using UnityEngine;
using System.Collections;

public class Fade_In : MonoBehaviour {

    Texture2D texture;
    public float constant = 1;

    public static bool fade_in_begin = false;
    public static bool fade_in_terminated = false;

    void Start()
    {
        fade_in_begin = true;
    }

    void Update()
    {
        constant -= 0.01f;

        if (constant < 0.0f)
        {
            fade_in_terminated = true;
            Destroy(this.gameObject);
        }
    }

    void OnGUI()
    {
        texture = (Texture2D)Resources.Load("Textures/Bg");
        Color tmpColor = GUI.color;
        GUI.color = new Color(1, 1, 1, constant);
        GUI.DrawTexture(new Rect(0, 0, 2048, 1536), texture);
        GUI.color = tmpColor;


    }
}
